package com.bmft.util.response.result;

import com.bmft.util.response._enum.ResultCode;
import lombok.Data;

/**
 * 我们这里使用泛型解决，Object，都返回Result没有业务含义的问题，
 * @author 25301
 */
@Data
public class Result<T> {

    private Integer code;

    private String message;

    private  T data;
    public Result(){
        this.code = 200;
        this.message = "ok";
        this.data = null;
    }
    public Result(ResultCode resultCode,T data){
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
        this.data = data;
    }
    public Result success(T data){
        return new Result<T>(ResultCode.SUCCESS,data);
    }
}

